package january.test_1_22;

import java.util.Scanner;



public class TestMain4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int right = str.length();
        int left = right - 1;
        while(left >= 0) {
            if(str.charAt(left) == ' ') {
                print(str,left,right);
                System.out.print(" ");
                right = left;
            }
            left--;
        }
        print(str,left,right);
    }
    public static void print(String str,int left,int right) {
        for(int i = left + 1; i <= right - 1; i++) {
            System.out.print(str.charAt(i));
        }
    }
}
